<?php
/**
 * Created by PhpStorm.
 * User: MIS
 * Date: 2018/10/22
 * Time: 11:16
 */
namespace Admin\Controller;
use Think\Controller;
class LoginController extends Controller {
    public function index(){


        $this->display();
    }

    public function  login(){
        $verify=new \Think\Verify();
        if($verify->check (I('yzm'))==false){
            $this->error('验证码错误');
        }

        $m=M("admin");
        $user =I("user");
        $pwd =I("password");
        $pwd=md5($pwd);
        if($m->where("`name`='$user' AND `password` ='$pwd'")->find()){
            //var_dump("11111111111");
           session('username',$user);
//           var_dump(session("username"));
//           exit();


           redirect(U("/Admin/Index/index"));
        }else{
            $this->error('用户名或密码错误');
        }
    }

}